﻿Public Class SIMSFMS
    Private Function GetFileVersionInfo(ByVal filename As String) As Version
        Return Version.Parse(FileVersionInfo.GetVersionInfo(filename).FileVersion)
    End Function
    Private Sub GroupBox1_Enter(sender As Object, e As EventArgs) Handles GroupBox1.Enter

    End Sub
    Public Sub CantFindINIFile()
        RCHTXTB_SIMSini.Text = "I'm Sorry Dave I Can't Do That...."
        RCHTXTB_SIMSini.AppendText(Environment.NewLine)
        RCHTXTB_SIMSini.AppendText(Environment.NewLine)
        RCHTXTB_SIMSini.AppendText("Oooopsie!")
        RCHTXTB_SIMSini.AppendText(Environment.NewLine)
        RCHTXTB_SIMSini.AppendText(Environment.NewLine)
        RCHTXTB_SIMSini.AppendText("File Not Found")
    End Sub
    Private Sub SIMSFMS_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        lbl_InsPulsarVer.Text = (GetFileVersionInfo("C:\Program Files\SIMS\SIMS .net\Pulsar.exe").ToString)
        If lbl_InsPulsarVer.Text = My.Settings.CurrentPulsarVersion Then
            lbl_PulsVCheck.Text = "Current!"
            lbl_PulsVCheck.ForeColor = Color.Green
            lbl_PulsVCheck.Font = New Font(lbl_PulsVCheck.Font, FontStyle.Bold)

        Else
            lbl_PulsVCheck.Text = "Out Of Date"
            lbl_PulsVCheck.ForeColor = Color.Red
        End If
    End Sub

    Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles SIMSini.CheckedChanged
        Dim SIMSINI As String = "C:\Windows\Sims.ini"
        If System.IO.File.Exists(SIMSINI) Then

            RCHTXTB_SIMSini.LoadFile("C:\Windows\Sims.ini", RichTextBoxStreamType.PlainText)
            'System.Diagnostics.Process.Start(SIMSINI)
        Else

            CantFindINIFile()

            ' MsgBox("SIMS.ini not exist????")

        End If
    End Sub

    Private Sub CONNECTini_CheckedChanged(sender As Object, e As EventArgs) Handles CONNECTini.CheckedChanged
        '
        Dim CONNECTINI As String = "C:\Program Files\SIMS\SIMS .net\Connect.ini"
        If System.IO.File.Exists(CONNECTINI) Then

            RCHTXTB_SIMSini.LoadFile(CONNECTINI, RichTextBoxStreamType.PlainText)
            'System.Diagnostics.Process.Start(SIMSINI)
        Else

            CantFindINIFile()

            ' MsgBox("SIMS.ini not exist????")

        End If
    End Sub

    Private Sub RCHTXTB_SIMSini_TextChanged(sender As Object, e As EventArgs) Handles RCHTXTB_SIMSini.TextChanged

    End Sub

    Private Sub SIMSLOADini_CheckedChanged(sender As Object, e As EventArgs) Handles SIMSLOADini.CheckedChanged
        Dim SIMSLOADINI As String = "C:\Program Files\SIMS\SIMS .net\SIMSLoad.ini"
        If System.IO.File.Exists(SIMSLOADINI) Then

            RCHTXTB_SIMSini.LoadFile("C:\Program Files\SIMS\SIMS .net\SIMSLoad.ini", RichTextBoxStreamType.PlainText)
            'System.Diagnostics.Process.Start(SIMSINI)
        Else

            CantFindINIFile()

            ' MsgBox("SIMS.ini not exist????")

        End If
    End Sub

    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click

    End Sub

    Private Sub RadioButton1_CheckedChanged_1(sender As Object, e As EventArgs) Handles CheckFMSLOADINI.CheckedChanged
        Dim FMSLOADINI As String = "C:\Program Files\SIMS\Finance\FMSLoad.ini"
        If System.IO.File.Exists(FMSLOADINI) Then

            RCHTXTB_SIMSini.LoadFile("C:\Program Files\SIMS\Finance\FMSLoad.ini", RichTextBoxStreamType.PlainText)
            'System.Diagnostics.Process.Start(SIMSINI)
        Else

            CantFindINIFile()

            ' MsgBox("SIMS.ini not exist????")

        End If
    End Sub

    Private Sub CheckFMSCONNECTINI_CheckedChanged(sender As Object, e As EventArgs) Handles CheckFMSCONNECTINI.CheckedChanged
        Dim FMSCONNINI As String = "C:\Program Files\SIMS\Finance\FMSconnect.ini"
        If System.IO.File.Exists(FMSCONNINI) Then

            RCHTXTB_SIMSini.LoadFile("C:\Program Files\SIMS\Finance\FMSconnect.ini", RichTextBoxStreamType.PlainText)
            'System.Diagnostics.Process.Start(SIMSINI)
        Else

            CantFindINIFile()

            ' MsgBox("SIMS.ini not exist????")

        End If
    End Sub

   
    Private Sub btn_EditCONNECTINI_Click(sender As Object, e As EventArgs) Handles btn_EditCONNECTINI.Click
        Dim CONNECTINI As String = "C:\Program Files\SIMS\SIMS .net\Connect.ini"
        If System.IO.File.Exists(CONNECTINI) Then

            'RCHTXTB_SIMSini.LoadFile("C:\Program Files\SIMS\SIMS .net\Connect.ini", RichTextBoxStreamType.PlainText)
            System.Diagnostics.Process.Start("notepad.exe", CONNECTINI)
        Else

            CantFindINIFile()

            ' MsgBox("SIMS.ini not exist????")

        End If
    End Sub
End Class